VideoHelp Forum




+ Reply to Thread
Results 1 to 5 of 5
  1. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    Hello

    I tried the following command to split an MP4 video exactly, which means re-encoding the video stream, while keeping the audio as-is since it was good enough:

    Code:
    ffmpeg -ss 02:34:48 -i input.mp4 -b:v 200k -t 02:51:40 -c:v libx264 -vf scale=640:-1 -pix_fmt yuv420p -c:a copy -shortest -threads 2 -crf 20 -f mp4 output.mp4
    Even though I used the "-shortest" option, ffmpeg keeps going past the length of the video (which is about 15mn, and I stopped ffmpeg at around 23mn).

    Does someone why, and if there's a way to avoid needlessly re-encoding the audio stream as well?

    Thank you.

    --
    Edit : I tried the "-to" option introduced in 2013, to no avail:

    Code:
    ffmpeg -ss 02:34:48 -i input.mp4 -b:v 200k -to 02:51:40
    Last edited by yetanotherlogin; 23rd Feb 2016 at 08:47.
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Are you sure you are using a newer version of ffmpeg? Use ffmpeg -version

    I guess you have read http://trac.ffmpeg.org/wiki/Seeking ?
    Quote Quote  
  3. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    Yes, I'm using the latest and greatest.

    I don't understand what this means:
    "Note that if you specify -ss before -i only, the timestamps will be reset to zero, so -t and -to have not the same effect. If you want to keep the original timestamps, add the -copytsoption."
    Quote Quote  
  4. You put '-ss 02:34:48' before the input thus ffmpeg starts at that point and the internal time stamp is now 0 at that point, so if you want to reencode from 02:34:48 to 02:51:40 you want to encode an interval of 00:16:52 and thus you should set the duration to 00:16:52 (-t 00:16:52).
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  5. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    Thanks for the info.

    This worked as expected:
    Code:
    ffmpeg -i input.mp4 -ss 00:05:00 -b:v 200k -to 00:05:30 -c:v libx264 -vf scale=640:-1 -pix_fmt yuv420p -c:a copy -shortest -threads 2 -crf 20 -f mp4 output.mp4
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!